package com.aoyy.action;

import java.util.Map;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
/**================================================================================
 * <code>UserLoginInterceptor</code> class for user login <code>interceptor</code>
 * @author Administrator
 * @date 2017-07-13
 * ================================================================================ */
public class UserLoginInterceptor extends AbstractInterceptor {
  private static final long serialVersionUID = 705071709383721531L;
  @Override
  public String intercept(ActionInvocation invocation) throws Exception {
	ActionContext context = invocation.getInvocationContext();
	Map<String, Object> session = context.getSession();
	if (session.get("user") != null) {
	  return invocation.invoke(); 	
	}
	return BaseAction.LOGIN;
  }
}
